#ifndef FREEWAYENTRY_H_INCLUDED
#define FREEWAYENTRY_H_INCLUDED
#include <sys/socket.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include "../public/public0.h"
#define MESGMAXLEN 1024
#define PORTNUM 1214
typedef struct sockaddr_in client;


class FreeWayEntry{
public:
    int fwRecv(char * recvBuff, int len);
    int fwRecv(char * recvBuff, int len, char * ipbuff);
    int fwSend(char * sendBuff, int len);
    int fwSend(const char * sendBuff, int len);
    int fwSend(char * sendBuff, int len ,client * addPtr);
    struct sockaddr_in getCliAddr(){
        return cliaddr;
    }

    //int fwSend2Server(char * buff, int len);


    int fwSend2Server(const char * buff, int len);

    bool init(int type);

    struct sockaddr_in buildAddr(const char * ipbuf, int port);

private:

    int sockfd;
    struct sockaddr_in cliaddr;
    struct sockaddr_in servaddr;
    char mesg[MESGMAXLEN];
};

#endif // FREEWAYENTRY_H_INCLUDED
